﻿namespace Sgr.Exceptions
{
    /// <summary>
    /// 不可恢复的集成事件异常
    /// </summary>
    public class UnrecoverableIntegrationEventException : Exception
    {
        /// <summary>
        /// 应用内部异常信息
        /// </summary>
        /// <param name="message">错误消息文本内容.</param>
        public UnrecoverableIntegrationEventException(string message)
            : base(message)
        {
        }

        /// <summary>
        /// 应用内部异常信息
        /// </summary>
		/// <param name="messageFormat">错误消息文本内容模板.</param>
		/// <param name="args">错误消息文本内容参数.</param>
        public UnrecoverableIntegrationEventException(string messageFormat, params object[] args)
            : base(string.Format(messageFormat, args))
        {
        }

        /// <summary>
        /// 应用内部异常信息
        /// </summary>
        /// <param name="message">错误消息文本内容.</param>
        /// <param name="innerException">引发当前异常的异常信息.</param>
        public UnrecoverableIntegrationEventException(string message, Exception innerException)
            : base(message, innerException)
        {
        }

        /// <summary>
        /// 异常数据
        /// </summary>
        /// <param name="name"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public UnrecoverableIntegrationEventException WithData(string name, object value)
        {
            Data[name] = value;
            return this;
        }

        ///// <summary>
        ///// 异常编号
        ///// </summary>
        //public string ErrorNo { get; set; } = "500";
    }
}